<template>
  <div>
    <!-- 组件应用 v-model -->
    <p>{{ num }} 人</p>
    <button @click="plus" style="width: 100px">（组件应用v-model） +1</button>
    <button @click="minus" style="width: 100px">（组件应用v-model） -1</button>
  </div>
</template>
<script>
export default {
  name: "inp",
  model: {
    prop: "num",
    event: "numChange",
  },
  props: {
    num: [String, Number],
  },
  data() {
    return {};
  },
  methods: {
    plus() {
      this.$emit("numChange", this.num * 1 + 1);
    },
    minus() {
      this.$emit("numChange", this.num - 1);
    },
  },
  mounted() {},
};
</script>
<style lang="scss" scoped></style>
